﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Category.aspx.cs" Inherits="www.Admin.Category" %>

<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=1.0.10920.32919, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
<%@ Import Namespace="www.Controllers" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Import Namespace="www.Core.Contract.DataContract" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">

        function CheckAllEmp(checkbox) {
            var gridVwHeaderChckbox = document.getElementById("<%=grid_Category.ClientID %>");
            for (i = 1; i < gridVwHeaderChckbox.rows.length; i++) {
                gridVwHeaderChckbox.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = checkbox.checked;
            }
        }

        function checkAllLanguage(checkboxlanguage) {
            var gridVwHeaderckbox = document.getElementById("<%=grvNgonngu.ClientID %>");
            for (i = 1; i < gridVwHeaderChckbox.rows.length; i++) {
                gridVwHeaderckbox.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = checkboxlanguage.checked;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div class="title">
        QUẢN LÝ DANH MỤC
    </div>
    <div class="clear">
    </div>
    <%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>--%>
    <div id="pnviews" runat="server">
        <div class="rows">
            <div class="ColLeft">
                <span id="Span2">Thể loại:</span>
            </div>
            <div class="ColRight">
                <asp:DropDownList ID="ddlType1" runat="server" CssClass="combobox" AutoPostBack="True" OnSelectedIndexChanged="ddlType_SelectedIndexChanged"></asp:DropDownList>
            </div>
        </div>
        <div class="clear"></div>
        <div class="frame ">
            <div class="table">
                <img src="../Design/Icon/icon/add.png" class="control" />
                <asp:LinkButton ID="lbtinsert1" runat="server" OnClick="lbtinsert_Click">Thêm mới</asp:LinkButton>
                <img src="../Design/Icon/icon/delete.png" class="control" />
                <asp:LinkButton ID="lbtdel1" runat="server" OnClick="lbtdel_Click">Xóa</asp:LinkButton>
                <img src="../Design/Icon/icon/refresh.png" class="control" />
                <asp:LinkButton ID="lbtrefresh1" runat="server" OnClick="lbtrefresh_Click">Làm tươi</asp:LinkButton>
                <img src="../Design/Icon/icon/uplevel.png" class="control" />
                <a href="javascript:void(0);" onclick="window.history.go(-1);">Trở lại</a>
            </div>
            <div>
                <asp:GridView ID="grid_Category" runat="server" AutoGenerateColumns="False" BackColor="White"
                    BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" Width="100%" AllowPaging="True"
                    PageSize="20" ShowHeaderWhenEmpty="True" OnRowCommand="grid_advertise_RowCommand" OnPageIndexChanging="grid_advertise_PageIndexChanging">
                    <columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <input id="chkselectall" type="checkbox" runat="server" onclick="CheckAllEmp(this);" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="chkselect" runat="server" />
                            </ItemTemplate>
                            <HeaderStyle Width="5%" HorizontalAlign="Center"></HeaderStyle>
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="False">
                            <ItemTemplate>
                                <asp:Label ID="lblId" runat="server" Text='<%#Eval("Id") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <span id="lblName">Tên danh mục</span>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <span id="lblName"><%#Eval("Name") %></span>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <span id="lblOrds">Thứ tự</span>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <span id="lblord"><%#Eval("Ord") %></span>
                            </ItemTemplate>
                            <HeaderStyle Width="10%"></HeaderStyle>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <span id="lblStatus">Trạng thái</span>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <span id="lbltt"><%# Utilities.Active(Convert.ToInt32(Eval("Active"))) %></span>
                            </ItemTemplate>
                            <HeaderStyle Width="13%"></HeaderStyle>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <span id="lblBusiness">Thao tác</span>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:ImageButton ID="ibtedit" runat="server" ToolTip='Sửa' CssClass="business" CommandName="cmd_edit"
                                    CommandArgument='<%#Eval("Id") %>' ImageUrl="../Design/Icon/icon/edit.png" />
                                <asp:ImageButton ID="ibtdel" runat="server" ToolTip='Xóa' CssClass="business" CommandName="cmd_delete"
                                    CommandArgument='<%#Eval("Id") %>' ImageUrl="../Design/Icon/icon/delete.png" />
                                <asp:ImageButton ID="ibtactive" runat="server" ToolTip='<%#Utilities.TooltipActive(Convert.ToInt32(Eval("active"))) %>'
                                    CommandArgument='<%#Eval("Id") %>' CommandName="cmd_active" CssClass="business" ImageUrl="../Design/Icon/icon/stop1.png" />
                            </ItemTemplate>
                            <HeaderStyle Width="16%"></HeaderStyle>
                        </asp:TemplateField>
                    </columns>
                    <footerstyle backcolor="#99CCCC" forecolor="#003399" />
                    <headerstyle backcolor="#003399" font-bold="True" forecolor="#CCCCFF" />
                    <pagerstyle backcolor="#99CCCC" forecolor="#003399" horizontalalign="Left" />
                    <rowstyle backcolor="White" forecolor="#003399" />
                    <selectedrowstyle backcolor="#009999" font-bold="True" forecolor="#CCFF99" />
                    <sortedascendingcellstyle backcolor="#EDF6F6" />
                    <sortedascendingheaderstyle backcolor="#0D4AC4" />
                    <sorteddescendingcellstyle backcolor="#D6DFDF" />
                    <sorteddescendingheaderstyle backcolor="#002876" />
                </asp:GridView>
            </div>
            <div class="table">
                <img src="../Design/Icon/icon/add.png" class="control" />
                <asp:LinkButton ID="lbtinsert2" runat="server" OnClick="lbtinsert_Click">Thêm mới</asp:LinkButton>
                <img src="../Design/Icon/icon/delete.png" class="control" />
                <asp:LinkButton ID="lbtdel2" runat="server" OnClick="lbtdel_Click">Xóa</asp:LinkButton>
                <img src="../Design/Icon/icon/refresh.png" class="control" />
                <asp:LinkButton ID="lbtrefress2" runat="server" OnClick="lbtrefresh_Click">Làm tươi</asp:LinkButton>
                <img src="../Design/Icon/icon/uplevel.png" class="control" />
                <a href="javascript:void(0);" onclick="window.history.go(-1);">Trở lại</a>
            </div>
        </div>
    </div>
    <div id="pncontrols" runat="server" visible="False">
        <div class="table">
            <img src="../Design/Icon/icon/page_save.png" class="control" />
            <asp:LinkButton ID="lbtsave1" runat="server" OnClick="lbtsave_Click">Lưu</asp:LinkButton>
            <img src="../Design/Icon/icon/moi.gif" class="control" />
            <asp:LinkButton ID="lbtdonew1" runat="server" OnClick="lbtdonew_Click">Làm mới</asp:LinkButton>
            <img src="../Design/Icon/icon/back.png" class="control" />
            <asp:LinkButton ID="lbtback1" runat="server" OnClick="lbtback_Click">Trở lại</asp:LinkButton>
        </div>
        <div class="frame">

            <asp:TabContainer ID="TabContainer2" runat="server" CssClass="NewsTab" ActiveTabIndex="0" Width="100%">
                <asp:TabPanel ID="TabBusiness" runat="server">
                    <headertemplate>Thông tin danh mục</headertemplate>
                    <contenttemplate>
                        <div class="rows">
                            <div class="ColLeft">
                                <span id="Span1">Danh mục cha:</span>
                            </div>
                            <div class="ColRight">
                                <select id="ddlType" runat="server" class="combobox"></select>
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span id="lblName">Tên:</span>
                            </div>
                            <div class="ColRight">
                                <input id="txtname" type="text" runat="server" class="textbox" />
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span id="lblkeyword">Từ khóa:</span>
                            </div>
                            <div class="ColRight">
                                <input id="txtKeyword" type="text" runat="server" class="textbox" />
                            </div>
                        </div>
                        <div class="textarial">
                            <div class="ColLeft">
                                <span id="lblNoiDung">Mô tả:</span>
                            </div>
                            <div class="ColRight">
                                <textarea id="txtdecription" runat="server" class="textarea2"></textarea>
                            </div>
                        </div>
                        <div class="rows">
                            <br />
                            <div class="ColLeft">
                                <span id="lblSapXep">Thứ tự:</span>
                            </div>
                            <div class="ColRight">
                                <input id="txtord" type="text" class="textbox" runat="server" />
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span id="lblTrangThai">Trạng thái:</span>
                            </div>
                            <div class="ColRight">
                                <input id="chkactive" type="checkbox" runat="server" class="checkbox" />
                            </div>
                        </div>
                    </contenttemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="TabLanguage" runat="server">
                    <headertemplate>Ngôn ngữ khác</headertemplate>
                    <contenttemplate>
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div class="rows">
                                    <div class="ColLeft">
                                        <span id="lblLanguage">Ngôn ngữ:</span>
                                    </div>
                                    <div class="ColRight">
                                        <select id="ddlLanguage" runat="server" class="combobox">
                                        </select>
                                    </div>
                                </div>
                                <div class="rows">
                                    <div class="ColLeft">
                                        <span id="lblNameValue">Tên:</span>
                                    </div>
                                    <div class="ColRight">
                                        <input id="txtName_Value" type="text" runat="server" class="textbox" />
                                    </div>
                                </div>
                                <div class="rows">
                                    <div class="ColLeft">
                                        <span id="lblKeywordvalue">Từ khóa:</span>
                                    </div>
                                    <div class="ColRight">
                                        <input id="txtKeywordValue" type="text" runat="server" class="textbox" />
                                    </div>
                                </div>
                                <div class="textarial">
                                    <div class="ColLeft">
                                        <span id="lblContentValue">Mô tả:</span>
                                    </div>
                                    <div class="ColRight">
                                        <textarea id="txtDecription_Value" class="textarea2" runat="server"></textarea>
                                    </div>
                                </div>
                                <div class="clear">
                                </div>
                                <div class="rows">
                                    <div class="ColLeft"></div>
                                    <div class="ColRight">
                                        <input id="btnThemValue" type="button" value="Thêm" class="button" runat="server" onserverclick="btnThemValue_Click" />
                                    </div>
                                </div>
                                <div class="clear">
                                </div>
                                <div>
                                    <asp:GridView ID="grvNgonngu" runat="server" AutoGenerateColumns="False" BackColor="White"
                                        BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" Width="100%" AllowPaging="True"
                                        PageSize="20" ShowHeaderWhenEmpty="True" OnRowCommand="grvNgonngu_RowCommand">
                                        <Columns>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <input id="chkselectall" type="checkbox" runat="server" onclick="CheckAllLanguage(this);" />
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chkselect" runat="server" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="False">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblLanguageCode" runat="server" Text='<%#Eval("LanguageCode") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <span id="lblLuanguage">Ngôn ngữ</span>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <span id="lblLuanguageCodes"><%#Utilities.Langguage.SelectLanguageName((List<RelaxLanguageDataContract>)Cache["Language"],Convert.ToInt32(Eval("LanguageCode"))) %></span>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <span id="lblName_Value">Tên</span>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="lblName_Values" runat="server" Text='<%#Eval("Name") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <span id="lblKeyword_Value">Từ khóa</span>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="lblKeyword_Values" runat="server" Text='<%#Eval("Keyword") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <span id="lblDetail_Value">Mô tả</span>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="lblDetail_Values" runat="server" Text='<%#Eval("Decription") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <span id="lblBusiness">Thao tác</span>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="ibtedit" runat="server" ToolTip='Sửa' CssClass="business" CommandName="cmd_edit"
                                                        CommandArgument='<%#Eval("LanguageCode") %>' ImageUrl="../Design/Icon/icon/edit.png" />
                                                    <asp:ImageButton ID="ibtdel" runat="server" ToolTip='Xóa' CssClass="business" CommandName="cmd_delete"
                                                        CommandArgument='<%#Eval("LanguageCode") %>' ImageUrl="../Design/Icon/icon/delete.png" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                                        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                                        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                                        <RowStyle BackColor="White" ForeColor="#003399" />
                                        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                                        <SortedAscendingCellStyle BackColor="#EDF6F6" />
                                        <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                                        <SortedDescendingCellStyle BackColor="#D6DFDF" />
                                        <SortedDescendingHeaderStyle BackColor="#002876" />
                                    </asp:GridView>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>

                    </contenttemplate>
                </asp:TabPanel>
            </asp:TabContainer>
        </div>
        <div class="table">
            <img src="../Design/Icon/icon/page_save.png" class="control" />
            <asp:LinkButton ID="lbtsave2" runat="server" OnClick="lbtsave_Click">Lưu</asp:LinkButton>
            <img src="../Design/Icon/icon/moi.gif" class="control" />
            <asp:LinkButton ID="lbtdonew2" runat="server" OnClick="lbtdonew_Click">Làm mới</asp:LinkButton>
            <img src="../Design/Icon/icon/back.png" class="control" />
            <asp:LinkButton ID="lbtback2" runat="server" OnClick="lbtback_Click">Trở lại</asp:LinkButton>
        </div>
    </div>
    <%--</ContentTemplate>
    </asp:UpdatePanel>--%>
</asp:Content>
